﻿using System.Collections;
using System.Collections.Generic;
using Unity.UIWidgets.engine;
using Unity.UIWidgets.material;
using Unity.UIWidgets.painting;
using Unity.UIWidgets.rendering;
using Unity.UIWidgets.ui;
using Unity.UIWidgets.widgets;
using UnityEngine;

public class DpiTestUIWidgets : UIWidgetsPanel
{
    protected override void OnEnable()
    {
        FontManager.instance.addFont(Resources.Load<Font>(path: "fonts/MaterialIcons-Regular"), "Material Icons");
        base.OnEnable();
    }

    protected override Widget createWidget()
    {
        return new MaterialApp(
            home: new Scaffold(
                appBar: new AppBar(
                    title: new Text("dpi test")
                ),
                body: new DpiTestApp()
            )
        );
    }

    class DpiTestApp : StatefulWidget
    {
        public override State createState()
        {
            return new MyState();
        }
    }

    class MyState : State<DpiTestApp>
    {
        public override Widget build(BuildContext context)
        {
            return new Container(
                padding: EdgeInsets.only(top: 20),
                child: new Column(
                    crossAxisAlignment:CrossAxisAlignment.start,
                    children: new List<Widget>()
                    {
                        new Text($"Screen Size: {Screen.width}x{Screen.height}"),
                        new Text($"devicePixelRatio: {Window.instance.devicePixelRatio}"),
                    }
                )
            );
        }
    }
}